<template>
  <app-view>
    <van-nav-bar left-text="重置密码" left-arrow :border="false" @click-left="onClickLeft" />
    <scroll-view>
      <new-password @success="onSuccess" />
    </scroll-view>
  </app-view>
</template>

<script>
  import ScrollView from '@components/scroll-view/index';
  import NewPassword from '@views/login/components/new-password';
  import ClickBtn from '@views/modules/access/components/click-btn';

  export default {
    components: { ScrollView, NewPassword, ClickBtn },
    data() {
      return {
        formData: {
          newPassword: '',
          newPassword2: ''
        } // 表单数据
      };
    },
    methods: {
      // 后退点击
      onClickLeft() {
        this.$router.push('./get-verification-code');
      },
      onSuccess() {
        this.$dialog.alert({ message: '密码重置成功' }).then(() => {
          this.$router.replace('/user');
        });
      }
    }
  };
</script>

<style scoped lang="less">
  @import '~@styles/var';
  @import '~@styles/modules/visitor/van-form';
  @import '~@styles/modules/visitor/van-popup';
  .app-view {
    background: #f7f7f7;
  }
  .van-nav-bar {
    background-color: #fff;
  }
</style>
